package com.coolw.toolkit.guava.collect;

import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ListMultimap;

import java.util.List;

/**
 * ListMultimap：key可以重复，value返回数组；Collection 转成 List
 *
 * @author coolw
 * @date 2024/1/25 9:35
 */
public class ListMultimapTest {

    public static void main(String[] args) {
        ListMultimap<String, String> listMultimap = ArrayListMultimap.create();
        listMultimap.put("code", "222");
        listMultimap.put("code", "111");
        listMultimap.put("code", "333");

        List<String> strList = listMultimap.get("code");
        // 输出 [111, 222, 333]
        System.out.println(strList);
    }
}
